<div class="row">
    <div class="col-md-12">
        <div class="btn-group">
        <empty name="cid">
        <button type="button" class="btn category-button btn-white" disabled>全部</button>
        <else/>
        <button type="button" class="btn category-button btn-white" data="0">全部</button>
        </empty>
        <volist name="categoryList" id="vo">
            <eq name="vo.id" value="$cid">
            <button type="button" class="btn category-button btn-white" disabled>{$vo.title}</button>
            <else/>
            <button type="button" class="btn category-button btn-white" data="{$vo.id}">{$vo.title}</button>
            </eq>
        </volist>
        </div>
        <div class="table-responsive">
            <table class="table table-primary table-striped">
                <thead>
                    <tr>
                        <th>#</th>
                        <th>标题</th>
                        <th>作者</th>
                        <th>来源</th>
                        <th>热度值</th>
                        <th>发布状态</th>
                        <th>封面</th>
                        <th>发布时间</th>
                        <th>创建时间</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    <volist name="list" id="vo">
                    <tr>
                        <td>{$vo.id}</td>
                        <td><a href="{:C('domain')}article/{$vo.id}" target="_blank">{$vo.title}</a></td>
                        <td>{$vo.author}</td>
                        <td>{$vo.source_name}</td>
                        <td>{$vo.hotnum}</td>
                        <empty name="vo.status">
                        <td><font color="red"><b>已下线</b></font></td>
                        <else/>
                        <td><?php echo ($vo['publishtime'] < NOW_TIME)?'<font color="green"><b>已发布</b></font>':'<font color="blue"><b>未发布</b></font>'; ?></td>
                        </empty>
                        <td><img src="{$vo.cover|imageUrl}" height="20"/></td>
                        <td>{$vo.publishtime|dateFormat}</td>
                        <td>{$vo.createtime|dateFormat}</td>
                        <td width="100">
                            <div class="btn-group">
                                <a href="/article/update?id={$vo.id}&cid={$cid}">修改</a>
                                <empty name="vo.status">
                                <a href="/article/online?id={$vo.id}">上线</a>
                                <else/>
                                <a href="/article/offline?id={$vo.id}">下线</a>
                                </empty>
                            </div>
                        </td>
                    </tr>
                    </volist>
                </tbody>
            </table>
        </div>
    </div>
</div>
<script>
$(".category-button").click(function() {
    var cid = $(this).attr("data");
    location.href="/article/pass?cid=" + cid;
});
</script>
